{extend name="public/base" /}

{block name="pjax_container"}
<?php
    $titleTypeName = '自定义分组';
?>

<style>
    tr>th,
    td {
        text-align: center;
    }
.layui-layer-content{
    padding: 15px;
}
    .btn-group-xs>.btn,
    .btn-xs {
        padding: 5px;
        margin: 0 5px;
    }
    
.content-header>.breadcrumb>li{
    color: #999;
}
.content-header>.breadcrumb>.active{
    color: #666;
}
.content-header{
    height: 51px;
 
}
.btn-primary{
      background-color: #1890FF;
    color: #fff;
    border: none;
    border-radius: 6px !important;
    margin-left: 15px;
    padding: 5px 10px;
    line-height: 24px; 
}
.box-primary{
  border-top-color: #ecf0f5 !important;
  border-top-width: 16px;
  
}
.btn-primary:hover{
     background-color: #1890FF;
    color: #fff;
    border: none;
    opacity: .9;
    border-radius: 6px !important; 
}
.delete-one{
    background-color: ff4141 !important;
    margin-left: 15px;
    border-radius: 6px;
    height: 34px;
}
.sreachs{
       background-color: #1890FF;
    color: #fff;
    border: none;
    border-radius: 6px !important;
    margin-left: 15px;
    padding: 7px 15px; 
}
</style>
<section class="content-header">
    <h4>{$titleTypeName}</h4>
    <ol class="breadcrumb">
        <li>统计排名</li>
        <li class="active">{$titleTypeName}</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">

                <div class="box-header with-border">
                    <div class="pull-left">
                        <a href="/company/reportset/index_add" class="btn btn-sm btn-primary xzrw"><i class="fa fa-save"></i> 新增</a>
                        <a href="javascript:;" class="btn btn-sm btn-primary" id="import_staff">批量导入人员</a>
                        <a href="{:url('reportset/down_exl')}" class="btn btn-sm btn-primary">下载导入模板</a>
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th>分组名称</th>
                            <th>操作</th>
                        </tr>
                        {volist name="$list" id="v"}
                        <tr>
                            <td>{$v["name"]}</td>
                            <td>
                                <a class="btn btn-primary" href="/company/reportset/index_edit/id/{$v['id']}"><i class="fa fa-edit"></i> 编辑</a>
                                <a class="btn btn-danger delete-one" href="javascript:void(0);" data-url="/company/reportset/index_del" data-id="{$v['id']}"><i class="fa fa-trash"></i> 删除</a>
                                <a href="{:url('index_staff', ['id'=>$v['id']])}" class='btn btn-primary btn-xs'>人员列表</a>
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$list->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $(function(){

        $(".select2").select2({language:"zh-CN"});

        // 列表部分 全选
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });
        $('.checkbox-toggle').on('ifChecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("check");
        });
        $('.checkbox-toggle').on('ifUnchecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("uncheck");
        });
    });
    layui.use(['layer', 'upload'], function(){
        var layer = layui.layer;
        var upload = layui.upload;
        var layer_index = '';//加载层
        //导入人员
        upload.render({
            elem: '#import_staff'
            ,url: "{:url('reportset/index_staff_import')}",
            accept:"file",
            exts:'xls|xlsx',
            size:'8192', // 8M大小
            choose:function(obj){
                layer_index = layer.load(2);
            },
            done: function(res){
                layer.close(layer_index);
                if(res.err == 1){
                    // layer.msg(res.msg, {icon:2});
                    layer.open({
                        type: 1,
                        title:'错误信息',
                        skin: 'layui-layer-demo', //样式类名
                        closeBtn: 1, //不显示关闭按钮
                        anim: 2,
                        shadeClose: true, //开启遮罩关闭
                        content: res.msg
                    });
                }else{
                    layer.msg(res.msg, {icon:1}, function(){
                        location.reload();
                    });
                }
            }
            ,error: function(){
                layer.close(layer_index);
            }
        });
    });
</script>
{/block}
